# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=cisco-torch
pkgver=0.4b
pkgrel=13
groups=('blackarch' 'blackarch-exploitation' 'blackarch-fingerprint'
        'blackarch-scanner')
pkgdesc='Cisco Torch mass scanning, fingerprinting, and exploitation tool.'
url='https://github.com/foreni-packages/cisco-torch/'
license=('LGPL')
depends=('perl' 'perl-net-telnet' 'perl-net-snmp' 'perl-net-ssh-perl'
         'perl-net-ssleay')
arch=('any')
source=("https://github.com/foreni-packages/cisco-torch/archive/debian/0.4b-1kali4.tar.gz")
sha512sums=('d477b637b0b6e299f5474d33c60ba18fe6f132436859c92d5b998ff42ad9a739f765ce41c6b6d2a2db7d5548168e1cb49d9510b051601a8b26d7b54b090b0247')

package() {
  cd "$pkgname-debian-$pkgver-1kali4"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname/"
  install -dm 755 "$pkgdir/usr/share/doc/$pkgname/"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" CHANGELOG.txt TODO \
    README.txt
  install -Dm 644 -t "$pkgdir/usr/share/$pkgname/" community.txt torch.conf \
    fingerprint.db brutefile.txt

  for f in brutefile.txt community.txt fingerprint.db password.txt \
    tfingerprint.db torch.conf users.txt; do
      install -Dm 644 $f "$pkgdir/usr/share/$pkgname/"
  done

  install -Dm 755 "$pkgname.pl" "$pkgdir/usr/share/$pkgname/"

  cp -r include "$pkgdir/usr/share/$pkgname/"
  cp -r tftproot "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
export PERL5LIB=/usr/share/$pkgname
cd /usr/share/$pkgname
exec perl $pkgname.pl "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

